import { prisma } from '@/lib/prisma'
import { NextResponse } from 'next/server'

export async function GET() {
  try {
    const suppliers = await prisma.supplier.findMany({
      where: {
        status: true
      },
      orderBy: {
        name: 'asc'
      }
    })
    return NextResponse.json(suppliers)
  } catch (error) {
    return NextResponse.json(
      { error: '获取供应商失败' },
      { status: 500 }
    )
  }
} 